<?php
require('jsonencode.php');
require('OModel.php');
$link = DBOpen();
$db_selected = mysql_select_db("calcwb",$link);
$sql = "SELECT MakeID AS value, Name AS text FROM make ";
$result = mysql_query($sql) or die(mysql_error());
$result_total = mysql_num_rows($result)-1;
$json = "["; 
$i=0;
while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
        if ( $i < $result_total) {
                $json = $json.json_encode($row).",";
        }
        else {
                $json = $json.json_encode($row);
        }
        $i = $i + 1;
}
$json = $json."]";
print ($json);
mysql_close($link);
?>
